package com.whxd.smarthome.core.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.whxd.smarthome.core.entity.DhDeviceShare;
public interface DhDeviceShareDao extends JpaRepository<DhDeviceShare, Long> {
	@Modifying
	@Query("delete from DhDeviceShare where deviceId = ?1")
	void deleteByDeviceId(String deviceId);//视频广场可以这么删除；分享给个人的情况，可能会删除具体某一条数据
	
	@Query("from DhDeviceShare where sharedType = 'square' and isLock != 'Y'")
	List<DhDeviceShare> getDeviceSquare();
	
	@Query("from DhDeviceShare where deviceId = ?1")
	DhDeviceShare getDeviceShare(String deviceId);
	
}
